// DuokanDigestDlg.h : header file
//

#pragma once
#include "afxcmn.h"

class CDigest{
public:
    CDigest()
        :m_idxStart(0)
        ,m_idxEnd(0)
    {};
    void Clear();

    CString     m_str;
    UINT        m_idxStart;
    UINT        m_idxEnd;
};

typedef vector<byte>  VEC_BYTE;

// CDuokanDigestDlg dialog
class CDuokanDigestDlg : public CDialog
{
    // Construction
    DECLARE_MESSAGE_MAP()
public:
	CDuokanDigestDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_DUOKANDIGEST_DIALOG };
    enum e_list_{
        E_LIST_IDX = 0,
        E_LIST_STRING, 

        E_LIST_MAX,
    };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
    afx_msg HCURSOR OnQueryDragIcon();
    afx_msg void OnBtnSave();
    afx_msg void OnDropFiles(HDROP   hDropInfo);
    afx_msg void OnBtnAbout();

    void    InitList();
    void    UpdateList();
    bool    ParseFile();
    bool    ParseFileDkp();
    bool    ParseFileTxt();
    bool    SaveToFile(const CString& cstrFileName);

protected:
    HICON           m_hIcon;
    CString         m_strFileNameDkp;
    CString         m_strFileNameTxt;
    CListCtrl       m_list;
    vector<CDigest>         m_vecDigest;
};

bool GetUintFromVector(const VEC_BYTE& vec, UINT idx, UINT& dest);
bool FindVectorInVector(const VEC_BYTE& vecSrc, const VEC_BYTE& vecToFind, UINT idxStart, UINT& idxFind);
